import request from '@/utils/request'

export function getAllCategory () {
  return request({
    url: '/v01/categorys/getall',
    method: 'get'
  })
}

export function addCategory (data) {
  return request({
    url: '/v01/categorys/add', // 假地址 自行替换
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
      // 'Access-Control-Allow-Origin':'http://www.yuejilife.com',
      // 'Access-Control-Allow-Methods':'POST,GET,OPTIONS,PUT,DELETE'
    },
    data: data
  })
}

export function updateCategory (param, data) {
  return request({
    url: '/v01/categorys/update',
    params: {
      id: param
    },
    method: 'put',
    data: data
  })
}

export function deleteCategory (param) {
  return request({
    url: '/v01/categorys/delete' + '?id=' + param,
    method: 'delete'
  })
}
